﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lion.WeiXin.Core.Models
{
   public class VipCardModel:BaseModel
    {
       public VipCardModel()
       {
           this.Last_Update_Date = DateTime.Now;
       }

        private string _code;
        private string _password;
        private decimal _cardvalue;
        private decimal _balance;
        private string _remark;
      
        /// <summary>
        ///  卡代码唯一
        /// </summary>
        public string Code
        {
            set { _code = value; }
            get { return _code; }
        }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password
        {
            set { _password = value; }
            get { return _password; }
        }
      
        /// <summary>
        /// 累计充值金额
        /// </summary>
        public decimal Recharge
        {
            set { _cardvalue = value; }
            get { return _cardvalue; }
        }
        /// <summary>
        /// 余额（次卡就是次数）
        /// </summary>
        public decimal Balance
        {
            set { _balance = value; }
            get { return _balance; }
        }
        /// <summary>
        /// 累积消费金额
        /// </summary>
        public decimal Total { get; set; }
        /// <summary>
        /// 卡类型
        /// </summary>
        public string Dic_CardType { get; set; }

       /// <summary>
       ///  卡等级
       /// </summary>
        public string Dic_CardLevel { get; set; }
 
        
        /// <summary>
        /// 卡状态编号
        /// </summary>
        public string Dic_State { get; set; }

 
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark
        {
            set { _remark = value; }
            get { return _remark; }
        }

        /// <summary>
        /// 电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 持卡人真实姓名
        /// </summary>
        public string RealName { get; set; }

       //默认 2999-01-01 就是永久有效
        private DateTime _endDate = DateTime.Parse("2999-01-01 00:00:00");
        //默认 2999-01-01 就是永久有效
        public DateTime EndDate {
            get{return _endDate;}
            set{_endDate = value;}
         }

        public string Could_Buy { get; set; }
        
        /// <summary>
        /// 最后更新时间
        /// </summary>
        public DateTime Last_Update_Date { get; set; }
       /// <summary>
       /// 最后修改人
       /// </summary>
        public string Last_Changed_By { get; set; }

        public DateTime? Birthday { get; set; } 


        #region 扩展字段

        /// <summary>
       /// 此卡享受折扣
       /// </summary>
        public decimal Discount { get; set; }

        /// <summary>
        /// 确认密码
        /// </summary>
        public string Password2 { get; set; }

        /// <summary>
        /// 扩展字段：卡状态名称
        /// </summary>
        public string State { get; set; }

        /// <summary>
        /// 扩展字段：卡等级名称
        /// </summary>
        public string CardLevelName { get; set; }
        /// <summary>
        /// 扩展字段：卡类型名称 储值卡和计次卡
        /// </summary>
        public string CardType { get; set; }

       /// <summary>
       /// 限制天数
       /// </summary>
       // public int LimitDays { get; set; }

        public string EndDateString {
            get {
                if(EndDate.Date>=DateTime.Now.Date)
                {
                     if (EndDate.Date == DateTime.Parse("2999-01-01 00:00:00").Date)
                    {
                        return "永久";
                    }
                     else
                     {
                         return EndDate.ToString("yyyy-MM-dd");
                     }                    
                }
                else
                {
                    return "过期";
                }               
            }
        }

        #endregion
     
    }
}
